import Vue from 'vue'
import dayJs from 'dayjs'
Vue.filter('setTime', (date) => {//setTime为过滤器名
  return dayJs(date).format('YYYY-MM-DD HH:mm:ss')
});
Vue.filter('dayTime', (date) => {//setTime为过滤器名
  return dayJs(date).format('YYYY-MM-DD')
});


Vue.filter('role', (role) => {
  if (role === 'admin') return '管理员'
  if (role === 'normal') return '普通学生'
  if (role === 'manage') return '学生干部'
  return '身份未知'
})

Vue.filter('title', (type) => {
  if (type === 'sent') return '发件箱'
  if (type === 'recipient') return '收件箱'
  if (type === 'draft') return '草稿箱'
})

export default Vue